package com.dify.knowledge.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dify.knowledge.entity.QuestionRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 问答记录Mapper接口
 */
@Mapper
public interface QuestionRecordMapper extends BaseMapper<QuestionRecord> {
    
    /**
     * 根据用户ID分页查询问答记录
     * @param page 分页对象
     * @param userId 用户ID
     * @return 分页结果
     */
    @Select("SELECT * FROM question_record WHERE user_id = #{userId} ORDER BY created_at DESC")
    Page<QuestionRecord> selectByUserId(Page<QuestionRecord> page, @Param("userId") Long userId);
}
